]> granicus.if.org Git - nethack/commitdiff
more ^R
authornethack.rankin <nethack.rankin>
Sun, 8 May 2005 04:22:53 +0000 (04:22 +0000)
committernethack.rankin <nethack.rankin>
Sun, 8 May 2005 04:22:53 +0000 (04:22 +0000)
> clear stale prompt
[...]
> Can someone who understands the relevant windowing code fix ^R in getpos()?

     I still don't understand why it wasn't working as expected, but moving
the existing cursor positioning after flush_screen() instead of before now
makes ^R work ok during getpos().  It doesn't restore the top line text so
isn't a transparent redraw but it now displays a prompt string there instead.
Likewise after typing '?' for help so that it should be move evident that
nethack is still waiting for you to move the cursor somewhere.

     Also add support for ^L in numpad mode.  I almost never use that and
didn't think of it the first time around.

doc/fixes34.4
include/extern.h
src/cmd.c
src/do_name.c

index 0e135111c6fa7a2a717a1df8317fcdce622478b5..90853cb8e04fca732fae8cb06ef9fb267f64b82e 100644 (file)
@@ -142,6 +142,8 @@ when adding an item to inventory, try to stack it with the quiver slot
 cockatrice meat has a distinct flavor to some
 wish request for "<something> armor" will match item named "<something> mail"
 Fire Brand and Frost Brand have a chance to avoid taking rust damage
+support ^R (and ^L in numpad mode) to request display repaint during direction
+       choosing and location choosing prompting modes
 
 
 Platform- and/or Interface-Specific New Features
index 4b1e0fd3912dd75dc8acd29e407016cdb022130f..2cea07cca6bf53f5c52630a66e8e994f2a8c93fd 100644 (file)
@@ -155,12 +155,13 @@ E boolean NDECL(status_hilite_menu);
 
 /* ### cmd.c ### */
 
+E boolean FDECL(redraw_cmd, (CHAR_P));
 #ifdef USE_TRAMPOLI
 E int NDECL(doextcmd);
 E int NDECL(domonability);
 E int NDECL(doprev_message);
 E int NDECL(timed_occupation);
-E int NDECL(wiz_attributes);
+E int NDECL(doattributes);
 E int NDECL(enter_explore_mode);
 # ifdef WIZARD
 E int NDECL(wiz_detect);
index 7282edad56ceb69066d3ee89f7508e1cc4ed22d5..de8ee99982fc1ee23d3f532a82250ee44f9e09d7 100644 (file)
--- a/src/cmd.c
+++ b/src/cmd.c
@@ -1301,6 +1301,7 @@ minimal_enlightenment()
        return (n != -1);
 }
 
+/* ^X command */
 STATIC_PTR int
 doattributes()
 {
@@ -1654,6 +1655,13 @@ add_debug_extended_commands()
        }
 }
 
+/* decide whether a character (user input keystroke) requests screen repaint */
+boolean
+redraw_cmd(c)
+char c;
+{
+    return (c == C('r') || (iflags.num_pad && c == C('l')));
+}
 
 static const char template[] = "%-18s %4ld  %6ld";
 static const char count_str[] = "                   count  bytes";
@@ -2171,7 +2179,7 @@ const char *s;
            dirsym = yn_function((s && *s != '^') ? s : "In what direction?",
                                        (char *)0, '\0');
 
-       if (dirsym == C('r')) {         /* ^R */
+       if (redraw_cmd(dirsym)) {               /* ^R */
            docrt();            /* redraw */
            goto retry;
        }
index 0f6e7a1a76943ef3c3b67776a6a5ec9ced389180..ee6ae05416d2dc77f83acc6935c89729446b2786 100644 (file)
@@ -23,11 +23,6 @@ nextmbuf()
        return bufs[bufidx];
 }
 
-/* same definition as in cmd.c */
-#ifndef C
-#define C(a) ((a) & 0x1f)      /* ^a */
-#endif
-
 /* the response for '?' help request in getpos() */
 STATIC_OVL void
 getpos_help(force, goal)
@@ -71,6 +66,7 @@ const char *goal;
     const char *sdp;
     if(iflags.num_pad) sdp = ndir; else sdp = sdir;    /* DICE workaround */
 
+    if (!goal) goal = "desired location";
     if (flags.verbose) {
        pline("(For instructions type a ?)");
        msg_given = TRUE;
@@ -80,8 +76,8 @@ const char *goal;
 #ifdef CLIPPING
     cliparound(cx, cy);
 #endif
-    curs(WIN_MAP, cx,cy);
     flush_screen(0);
+    curs(WIN_MAP, cx, cy);
 #ifdef MAC
     lock_mouse_cursor(TRUE);
 #endif
@@ -139,10 +135,14 @@ const char *goal;
            goto nxtc;
        }
 
-       if(c == '?'){
-           getpos_help(force, goal);
-       } else if (c == C('r')) {               /* ^R */
-           docrt();            /* redraw */
+       if (c == '?' || redraw_cmd(c)) {
+           if (c == '?')
+               getpos_help(force, goal);
+           else                /* ^R */
+               docrt();        /* redraw */
+           /* update message window to reflect that we're still targetting */
+           pline("Move cursor to %s:", goal);
+           msg_given = TRUE;
        } else {
            if (!index(quitchars, c)) {
                char matching[MAXPCHARS];
@@ -197,8 +197,8 @@ const char *goal;
 #ifdef CLIPPING
        cliparound(cx, cy);
 #endif
-       curs(WIN_MAP,cx,cy);
        flush_screen(0);
+       curs(WIN_MAP, cx, cy);
     }
 #ifdef MAC
     lock_mouse_cursor(FALSE);