summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLars Kotthoff <larsko@uwyo.edu>2018-10-22 20:49:10 -0600
committerGaute Hope <eg@gaute.vetsj.com>2018-11-06 18:55:53 +0100
commitf94ba78d5ee172ce9f91730eea455c8b55dd054b (patch)
treeaa2574b05c463f25df269c5144d210a3daa25c7c /src
parent24c58ecbafd510f96b3fda48cfdc4656591e8186 (diff)
allow normal editing when not on the boundary of a tag
Diffstat (limited to 'src')
-rw-r--r--src/command_bar.cc11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/command_bar.cc b/src/command_bar.cc
index 2aeba7b..e18e107 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 ();
+ // normal behavior if we're not in between tags
+ if (txt[pos] != ' ' && pos > 0 && pos < txt.size ()) return false;
// skip two spaces at the end
if (pos == txt.size ()) pos--;
if (pos > 0) pos--;
@@ -273,6 +275,8 @@ namespace Astroid {
if (mode == CommandMode::Tag || mode == CommandMode::DiffTag) {
ustring txt = entry.get_text ();
ustring_sz end = entry.get_position ();
+ // normal behavior if we're not in between tags
+ if (txt[end] != ' ' && end > 0 && end < txt.size ()) return false;
ustring_sz start = end;
// skip two spaces at the end
if (start == txt.size ()) start--;
@@ -290,6 +294,8 @@ namespace Astroid {
if (mode == CommandMode::Tag || mode == CommandMode::DiffTag) {
ustring txt = entry.get_text ();
ustring_sz pos = entry.get_position ();
+ // normal behavior if we're not in between tags
+ if (txt[pos] != ' ' && pos > 0 && pos < txt.size ()) return false;
if (pos < txt.size ()) pos++;
while (txt[pos] != ' ' && pos < txt.size ()) pos++;
entry.set_position (pos);
@@ -303,6 +309,8 @@ namespace Astroid {
if (mode == CommandMode::Tag || mode == CommandMode::DiffTag) {
ustring txt = entry.get_text ();
ustring_sz start = entry.get_position ();
+ // normal behavior if we're not in between tags
+ if (txt[start] != ' ' && start > 0 && start < txt.size ()) return false;
ustring_sz end = start;
if (end < txt.size ()) end++;
while (txt[end] != ' ' && end < txt.size ()) end++;
@@ -355,6 +363,9 @@ namespace Astroid {
return true;
}
+ if (mode == CommandMode::Tag || mode == CommandMode::DiffTag) {
+ return true;
+ }
}
break;