better buffer loading
This commit is contained in:
parent
8feecdb45c
commit
ab9e88bad5
11
lambda.py
11
lambda.py
@ -74,20 +74,27 @@ def start(stdscr, buffer_name, buffer_list):
|
|||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
parser = argparse.ArgumentParser(description="Process some integers.")
|
parser = argparse.ArgumentParser(description="Next generation hackable text editor for nerds.")
|
||||||
parser.add_argument("file", metavar="file", type=str, nargs="?",
|
parser.add_argument("file", metavar="file", type=str, nargs="?",
|
||||||
help="File to open")
|
help="The name of a file for lambda to open")
|
||||||
|
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
# Check if a file name has been inputted
|
# Check if a file name has been inputted
|
||||||
if args.file:
|
if args.file:
|
||||||
buffer_name = args.file
|
buffer_name = args.file
|
||||||
|
|
||||||
|
# Only if the file exists
|
||||||
|
if os.path.exists(args.file):
|
||||||
|
# Load the file into the buffer
|
||||||
buffer_list = files.open_file(buffer_name)
|
buffer_list = files.open_file(buffer_name)
|
||||||
|
|
||||||
# Convert each line into a list of lists with each element of the sublist representing one character
|
# Convert each line into a list of lists with each element of the sublist representing one character
|
||||||
for index, line in enumerate(buffer_list):
|
for index, line in enumerate(buffer_list):
|
||||||
buffer_list[index] = list(line)
|
buffer_list[index] = list(line)
|
||||||
|
|
||||||
|
else:
|
||||||
|
buffer_list = [[""]]
|
||||||
|
|
||||||
else:
|
else:
|
||||||
buffer_name = "[No Name]"
|
buffer_name = "[No Name]"
|
||||||
buffer_list = [[""]]
|
buffer_list = [[""]]
|
||||||
|
Loading…
Reference in New Issue
Block a user