aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorA Farzat <a@farzat.xyz>2022-05-14 15:57:07 +0900
committerA Farzat <a@farzat.xyz>2022-05-14 15:57:07 +0900
commit8499a1e4730828b46cdf03dfc285556b70a1a610 (patch)
treec0667b186ef094aaa7fa4bbe54b94c630235daa5
parenta4abdb28fffe966d6888a83d083685fadd17f7a1 (diff)
parent257ae01ffcec943804989ff24e73dceec2fea654 (diff)
downloadedit-8499a1e4730828b46cdf03dfc285556b70a1a610.tar.gz
edit-8499a1e4730828b46cdf03dfc285556b70a1a610.zip
Merge branch 'noeol'
-rw-r--r--edit.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/edit.py b/edit.py
index 87a0403..d2a9647 100644
--- a/edit.py
+++ b/edit.py
@@ -65,6 +65,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)))