]> git.neil.brown.name Git - edlib.git/commitdiff
diff: use correct file name in 'pre' mode.
authorNeilBrown <neil@brown.name>
Fri, 25 Aug 2023 05:47:05 +0000 (15:47 +1000)
committerNeilBrown <neil@brown.name>
Fri, 25 Aug 2023 05:47:05 +0000 (15:47 +1000)
When in 'pre' mode we need to go to the 'pre' file, not the post one.
So get the filename after '---'.

Also re-arrange some from the triage in the TODO file.

Signed-off-by: NeilBrown <neil@brown.name>
DOC/TODO.md
lib-search.c
python/lib-diff.py

index 132dce2f22394f35195f0d55d35c223ca46a6b8b..2e7532f6bfd549269a4ea2a966b16648c5576fab 100644 (file)
@@ -42,24 +42,12 @@ the file.
 - [X] should zoom affect whole window, not just pane?
 - [X] ditch cached-size for images - store in pane data instead.
 - [X] use foreach_attr for parsing image details
-- [ ] mergeview command to show diff between "found" and "replacement".
-- [ ] mergeview command to include both found and replacement, discard
   expected
 - [X] ./edlib -g doesn't work
-- [ ] Review the options for editing a merge - it doesn't always do what
-      I want.  Maybe have a menu of choices to remind me
-- [ ] Teach render-lines to pad spaces to left/right align text
 - [X] Store welcome page in a separate document
 - [ ] revise *Welcome* page
-- [ ] history doesn't restore initial default (or empty) string when
-      returning after excursion into history or favourites.
-- [ ] how can we save history-favourites back to a config file?
 - [X] K:ESC should cancel any current selection.
-- [ ] multi-file search-replace.  Find files with 'git-grep'
-- [ ] rexel term for "expression" with balanced brackets.
-      Also quotes and maybe <>.  Possibly a list of pairs?
-- [ ] python command to shift indent of range.
-- [ ] lib-diff : self.which should be used to determine which filename
+- [X] lib-diff : self.which should be used to determine which filename
       to grab.
 
 ### Small
@@ -306,6 +294,8 @@ Module features
       returned if a flag allowed a match, but the char didn't.
 - [ ] support backward search by compiling expression backwards
 - [ ] make prefix-fast-search work for case-insensitive matches??
+- [ ] rexel term for "expression" with balanced brackets.
+      Also quotes and maybe <>.  Possibly a list of pairs?
 
 ### popup
 
@@ -329,12 +319,16 @@ Module features
 
 ### lib-mergeview
 
+- [ ] Menu of options somewhere to remind me.
+- [ ] mergeview command to show diff between "found" and "replacement".
+- [ ] mergeview command to include both found and replacement, discard
 - [ ] Consider what else can be done with < and > on other markers.
 - [ ] Capture a new doc-reappeared for when reloaded, and search again
       for markers.
 
 ### emacs
 
+- [ ] multi-file search-replace.  Find files with 'git-grep'
 - [ ] there is no way to count characters in a range, or find how many
       characters into the document I am.  Maybe bytes would be good too.
 - [ ] :CX-= to look-up unicode name of character if not ASCII
@@ -362,6 +356,10 @@ Module features
 
 #### history
 
+- [ ] history doesn't restore initial default (or empty) string when
+      returning after excursion into history or favourites.
+- [ ] how can we save history-favourites back to a config file?
+
 ### ncurses
 
 - [ ] What to do with Focus-in/out keys?
@@ -401,6 +399,7 @@ Module features
 
 ### lib-renderline
 
+- [ ] Teach render-lines to pad spaces to left/right align text
 - [ ] Maybe "word-wrap" should be a list of characters to wrap on??
       But I might want "comma and following spaces".  How do I say that?
       Possibly declare some chars that cause a map-attr callback??
@@ -744,6 +743,7 @@ Module features
 
 - [ ] configuration: use tabs or spaces for indent
 - [ ] configuration: use only spaces for bracket-alignment indents - or tabs as well.
+- [ ] python command to shift indent of range.
 - [ ] python-mode: when changing indent, make same change to the whole block.
       Not sure how to handle 'else:' which looks like the next block.
 - [ ] in python mode, a comment at the end of an 'if' block confuses indenting.
index 5c96a8291c1e9c6333bb7920a780ad848bd5d00e..fedfd0d2dd746b44c10550aca955d03b4de63791 100644 (file)
@@ -14,7 +14,7 @@
  *
  * "text-match" is similar to text-search forwards, but requires that
  * the match starts at ->mark.  ->mark is moved to the end of the
- * match is the text does, in fact, match.
+ * match if the text does, in fact, match.
  * If the match fails, Efalse is returned (different to "text-search")
  */
 
index b0e0bd771a64b40f6a4659eebd30ca7e6c5ab5ac..08cb60dce6d7a69c0e0774ab8b9adea361ef4bbe 100644 (file)
@@ -272,10 +272,18 @@ class DiffPane(edlib.Pane):
         except edlib.commandfailed:
             focus.call("Message", "Not on a diff hunk! No +++ line found")
             return 1
+        if self.which > 0:
+            # Need the "pre" file name - hopefully on previous line.
+            m2 = m.dup()
+            focus.call("doc:EOL", -2, m2)
+            if focus.call("text-match", "^---", m2) > 0:
+                # found it.  need to return to start of line
+                focus.call("doc:EOL", -1, m2)
+                m.to_mark(m2)
         ms = m.dup()
         focus.call("doc:EOL", 1, m)
         fname = focus.call("doc:get-str", ms, m, ret='str')
-        fname = fname.lstrip('+ ')
+        fname = fname.lstrip('-+ ')
 
         # quilt adds timestamp info after a tab
         tb = fname.find('\t')