diff options
author | Lars Kotthoff <larsko@uwyo.edu> | 2018-10-22 20:40:07 -0600 |
---|---|---|
committer | Gaute Hope <eg@gaute.vetsj.com> | 2018-11-06 18:55:53 +0100 |
commit | 24c58ecbafd510f96b3fda48cfdc4656591e8186 (patch) | |
tree | b800bf2202a63752e9cb67ece1c33f79b933a6c9 /src | |
parent | ab2805aead84415e54f6b1fdb44e56a9caac543d (diff) |
skip double space at end of tags
Diffstat (limited to 'src')
-rw-r--r-- | src/command_bar.cc | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/command_bar.cc b/src/command_bar.cc index dee88af..2aeba7b 100644 --- a/src/command_bar.cc +++ b/src/command_bar.cc @@ -258,6 +258,8 @@ namespace Astroid { if (mode == CommandMode::Tag || mode == CommandMode::DiffTag) { ustring txt = entry.get_text (); ustring_sz pos = entry.get_position (); + // skip two spaces at the end + if (pos == txt.size ()) pos--; if (pos > 0) pos--; while (txt[pos] != ' ' && pos > 0) pos--; entry.set_position (pos); @@ -272,6 +274,8 @@ namespace Astroid { ustring txt = entry.get_text (); ustring_sz end = entry.get_position (); ustring_sz start = end; + // skip two spaces at the end + if (start == txt.size ()) start--; if (start > 0) start--; while (txt[start] != ' ' && start > 0) start--; entry.set_text (txt.substr (0, start) + txt.substr (end, txt.size () - end)); @@ -287,7 +291,7 @@ namespace Astroid { ustring txt = entry.get_text (); ustring_sz pos = entry.get_position (); if (pos < txt.size ()) pos++; - while (txt[pos] != ' ' && pos < txt.size()) pos++; + while (txt[pos] != ' ' && pos < txt.size ()) pos++; entry.set_position (pos); return true; } |