pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/devel/diffbreaker UI change moving though the diff now...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/ce49da6bc8db
branches:  trunk
changeset: 440535:ce49da6bc8db
user:      nat <nat%pkgsrc.org@localhost>
date:      Sun Oct 11 01:57:03 2020 +0000

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

Bump version.

diffstat:

 devel/diffbreaker/Makefile                        |   4 +-
 devel/diffbreaker/files/diffbreaker/diffbreaker.c |  27 +++++++++++++++++++---
 2 files changed, 25 insertions(+), 6 deletions(-)

diffs (75 lines):

diff -r 51ae5acda5af -r ce49da6bc8db devel/diffbreaker/Makefile
--- a/devel/diffbreaker/Makefile        Sat Oct 10 20:21:24 2020 +0000
+++ b/devel/diffbreaker/Makefile        Sun Oct 11 01:57:03 2020 +0000
@@ -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
 
diff -r 51ae5acda5af -r ce49da6bc8db devel/diffbreaker/files/diffbreaker/diffbreaker.c
--- a/devel/diffbreaker/files/diffbreaker/diffbreaker.c Sat Oct 10 20:21:24 2020 +0000
+++ b/devel/diffbreaker/files/diffbreaker/diffbreaker.c Sun Oct 11 01:57:03 2020 +0000
@@ -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 @@
        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 @@
                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