pkgsrc-Changes archive

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

CVS commit: pkgsrc/devel/diffbreaker



Module Name:    pkgsrc
Committed By:   nat
Date:           Sun Oct 11 01:57:04 UTC 2020

Modified Files:
        pkgsrc/devel/diffbreaker: Makefile
        pkgsrc/devel/diffbreaker/files/diffbreaker: diffbreaker.c

Log Message:
UI change moving though the diff now moves to next marker which was
the prev/intended behaviour.

Bump version.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 pkgsrc/devel/diffbreaker/Makefile
cvs rdiff -u -r1.9 -r1.10 \
    pkgsrc/devel/diffbreaker/files/diffbreaker/diffbreaker.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: pkgsrc/devel/diffbreaker/Makefile
diff -u pkgsrc/devel/diffbreaker/Makefile:1.4 pkgsrc/devel/diffbreaker/Makefile:1.5
--- pkgsrc/devel/diffbreaker/Makefile:1.4       Tue Aug 11 18:48:10 2020
+++ pkgsrc/devel/diffbreaker/Makefile   Sun Oct 11 01:57:03 2020
@@ -1,6 +1,6 @@
-# $NetBSD: Makefile,v 1.4 2020/08/11 18:48:10 joerg Exp $
+# $NetBSD: Makefile,v 1.5 2020/10/11 01:57:03 nat Exp $
 
-PKGNAME=       diffbreaker-0.2
+PKGNAME=       diffbreaker-0.3
 #PKGREVISION=  1
 CATEGORIES=    devel
 

Index: pkgsrc/devel/diffbreaker/files/diffbreaker/diffbreaker.c
diff -u pkgsrc/devel/diffbreaker/files/diffbreaker/diffbreaker.c:1.9 pkgsrc/devel/diffbreaker/files/diffbreaker/diffbreaker.c:1.10
--- pkgsrc/devel/diffbreaker/files/diffbreaker/diffbreaker.c:1.9        Tue Aug 11 18:48:10 2020
+++ pkgsrc/devel/diffbreaker/files/diffbreaker/diffbreaker.c    Sun Oct 11 01:57:04 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: diffbreaker.c,v 1.9 2020/08/11 18:48:10 joerg Exp $ */
+/* $NetBSD: diffbreaker.c,v 1.10 2020/10/11 01:57:04 nat Exp $ */
 
 /*-
  * Copyright (c) 2018, 2019 Nathanial Sloss <nathanialsloss%yahoo.com.au@localhost>
@@ -40,6 +40,7 @@
 ssize_t finalize_context(ssize_t context, ssize_t current, ssize_t secthead,
                     ssize_t first, ssize_t part, ssize_t origoffs,
                     ssize_t newoffs, ssize_t last, ssize_t pos);
+ssize_t find_next_marker(ssize_t current, int direction);
 ssize_t update_context(ssize_t lines, ssize_t current, ssize_t last);
 ssize_t get_context(ssize_t current, ssize_t last, ssize_t num);
 void print_buffer(ssize_t myLine, ssize_t dispLines);
@@ -149,6 +150,23 @@ mark_dirty(void)
        return;
 }
 
+#define DIR_UP         -1
+#define DIR_DOWN         1
+ssize_t
+find_next_marker(ssize_t current, int direction)
+{
+       ssize_t newline = current;
+       while (newline >= 0 && newline < totalLines - 1) {
+               newline += direction;
+               if (action[newline] != 0)
+                       break;
+       }
+       if (newline < 0 || newline >= totalLines - 1)
+               return current;
+
+       return newline;
+}
+
 ssize_t
 update_context(ssize_t lines, ssize_t current, ssize_t last)
 {
@@ -639,17 +657,18 @@ main(int argc, char *argv[])
                if (myKey == 'q')
                        break;
                if (myKey == 'k' && currentLine > 0)
-                       currentLine--;
+                       currentLine = find_next_marker(currentLine, DIR_UP);
                if (myKey == ' ') {
                        if (action[currentLine] == 1)
                                action[currentLine] = 2;
                        else if (action[currentLine] == 2)
                                action[currentLine] = 1;
                        if (currentLine < totalLines -1)
-                               currentLine++;
+                               currentLine = find_next_marker(currentLine,
+                                   DIR_DOWN);
                }
                if (myKey == 'j' && currentLine < totalLines - 1)
-                       currentLine++;
+                       currentLine = find_next_marker(currentLine, DIR_DOWN);
                if (myKey == 'G')
                        currentLine = totalLines - 1;
                if (myKey == 'g')



Home | Main Index | Thread Index | Old Index