[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

zile shell-command crash bug

From: acoret
Subject: zile shell-command crash bug
Date: Sat, 16 Oct 2021 20:15:26 +0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.2.0

* when zile try to execute shell-command at *Shell Command Output* buffer,
it will just crash*.
* when shell-command output the multiline result, it won't open the new
windows to show it.

and when i read the source code, i find it should open the new window
for the multiline output, but it actually use the wrong method to check
if it contain the multiline output. it should use the first index of
char not the last index of char, because the last index of char must be
the res.length -1. if there is '\n' before the last char it must contain
the multiline.

> PS: i don't know why it will fix the *crash bug*, but it does fix it.

--- zile-2.6.2/src/shell.vala
+++ zile-2.6.2/src/shell.vala
@@ -47,11 +47,11 @@
cur_bp.goto_offset (r.start);
del = r.size ();
cur_bp.replace_estr (del, res);
} else {
- int eol_pos = ((string) res.text).last_index_of_char ('\n');
+ int eol_pos = ((string) res.text).index_of_char ('\n');
bool more_than_one_line = eol_pos != -1 && eol_pos != res.length - 1;
write_temp_buffer (
"*Shell Command Output*",
() => { cur_bp.insert_estr (res); }

reply via email to

[Prev in Thread] Current Thread [Next in Thread]