poke-devel
[Top][All Lists]
Advanced

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

[COMMITTED] poke: allow `q' in pager, and style --More--


From: Jose E. Marchesi
Subject: [COMMITTED] poke: allow `q' in pager, and style --More--
Date: Sat, 29 Jan 2022 17:20:50 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

2022-01-29  Jose E. Marchesi  <jemarch@gnu.org>

        * poke/pk-term.c (pager_inhibited_p): New variable.
        (pk_term_start_pager): Reset pager_inhibited_p.
        (pk_puts_paged): Handle `q' in pager.
        (pk_puts_paged): Style --More--.
        * etc/poke-dark.css (.pager-more): New class.
        * etc/poke-bright.css (.pager-more): Likewise.
---
 ChangeLog           |  9 +++++++++
 etc/poke-bright.css |  2 ++
 etc/poke-dark.css   |  2 ++
 poke/pk-term.c      | 14 ++++++++++++++
 4 files changed, 27 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index c871572e..f246df93 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
 2022-01-29  Jose E. Marchesi  <jemarch@gnu.org>
 
+       * poke/pk-term.c (pager_inhibited_p): New variable.
+       (pk_term_start_pager): Reset pager_inhibited_p.
+       (pk_puts_paged): Handle `q' in pager.
+       (pk_puts_paged): Style --More--.
+       * etc/poke-dark.css (.pager-more): New class.
+       * etc/poke-bright.css (.pager-more): Likewise.
+
+2022-01-29  Jose E. Marchesi  <jemarch@gnu.org>
+
        * poke/pk-settings.pk: Add setting for `pager'.
        * poke/poke.h: Remove poke_pager_p.
        * poke/poke.c: Likewise.
diff --git a/etc/poke-bright.css b/etc/poke-bright.css
index 46a29388..f4701d23 100644
--- a/etc/poke-bright.css
+++ b/etc/poke-bright.css
@@ -44,6 +44,8 @@
 .pvm-register { color: green; }
 .pvm-number { color: lightgreen; }
 
+.pager-more { color: white; background-color: black; }
+
 html {
     font-family: Menlo, Monaco, "Courier New", monospace;
 }
diff --git a/etc/poke-dark.css b/etc/poke-dark.css
index d574c7bb..b1c9bfef 100644
--- a/etc/poke-dark.css
+++ b/etc/poke-dark.css
@@ -44,6 +44,8 @@
 .pvm-register { color: green; }
 .pvm-number { color: lightgreen; }
 
+.pager-more { color: black; background-color: white; }
+
 html {
     font-family: Menlo, Monaco, "Courier New", monospace;
 }
diff --git a/poke/pk-term.c b/poke/pk-term.c
index ef908301..d61d2f96 100644
--- a/poke/pk-term.c
+++ b/poke/pk-term.c
@@ -39,6 +39,7 @@ static int screen_lines;
 static int screen_cols;
 
 static int pager_active_p;
+static int pager_inhibited_p;
 static int nlines = 1;
 
 /* Default style to use when the user doesn't specify a style file.
@@ -300,6 +301,7 @@ void
 pk_term_start_pager (void)
 {
   pager_active_p = 1;
+  pager_inhibited_p = 0;
   nlines = 1;
 }
 
@@ -314,6 +316,8 @@ pk_puts_paged (const char *lines)
 {
   char *start, *end;
 
+  if (pager_inhibited_p)
+    return;
 
   start = (char *) lines;
 
@@ -335,7 +339,9 @@ pk_puts_paged (const char *lines)
         struct termios old_termios;
         struct termios new_termios;
 
+        styled_ostream_begin_use_class (pk_ostream, "pager-more");
         ostream_write_str (pk_ostream, "--More--");
+        styled_ostream_end_use_class (pk_ostream, "pager-more");
         ostream_flush (pk_ostream, FLUSH_THIS_STREAM);
 
         /* Set stdin in non-buffered mode.  */
@@ -361,6 +367,11 @@ pk_puts_paged (const char *lines)
                 nlines = 1;
                 break;
               }
+            if (c == 'q')
+              {
+                pager_inhibited_p = 1;
+                break;
+              }
 
             /* Ding! 8-) */
             fprintf (stderr, "\007");
@@ -368,7 +379,10 @@ pk_puts_paged (const char *lines)
 
         /* Restore stdin to buffered-mode.  */
         tcsetattr (0, TCSANOW, &old_termios);
+
         ostream_write_str (pk_ostream, "\n");
+        if (pager_inhibited_p)
+          return;
      }
   } while (*end != '\0');
 }
-- 
2.11.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]