diff options
author | A Farzat <a@farzat.xyz> | 2022-05-14 15:55:43 +0900 |
---|---|---|
committer | A Farzat <a@farzat.xyz> | 2022-05-14 15:55:43 +0900 |
commit | 257ae01ffcec943804989ff24e73dceec2fea654 (patch) | |
tree | b49302efe017ad761acd666e11970c51a98ad583 | |
parent | c1f6966d32f8c54a480fa60b20eb9e82c4a16a33 (diff) | |
download | edit-257ae01ffcec943804989ff24e73dceec2fea654.tar.gz edit-257ae01ffcec943804989ff24e73dceec2fea654.zip |
Remove trailing newline character if exists
-rw-r--r-- | edit.py | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -60,6 +60,9 @@ def read_file(path, buf): with open(PATH) as f: text = f.read() + if text[-1] == "\n": + text = text[:-1] # remove trailing newline if exists. + weechat.buffer_set(buf, "input", text) weechat.buffer_set(buf, "input_pos", str(len(text))) |