Add Tab display of labels syslinux-3.72-pre6
authorH. Peter Anvin <hpa@zytor.com>
Wed, 10 Sep 2008 04:31:55 +0000 (21:31 -0700)
committerH. Peter Anvin <hpa@zytor.com>
Wed, 10 Sep 2008 04:31:55 +0000 (21:31 -0700)
When the Tab key is pressed, display a list of matching labels.  This
can be disabled via the NOCOMPLETE configuration command.  This is a
slightly modified patch by Sebastian Herbszt.

NEWS
core/keywords
core/keywords.inc
core/parseconfig.inc
core/ui.inc
doc/syslinux.txt

diff --git a/NEWS b/NEWS
index 52e6717..5180be0 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -21,6 +21,9 @@ Changes in 3.72:
        * Remote gdb support for COM32 modules; patch from Stefan
          Hajnoczi.
        * Support beeps in F-key help in the simple menu system.
+       * Tab display of labels, based on a patch from Sebastian
+         Herbszt.  Can be disabled with the NOCOMPLETE configuration
+         command.
 
 Changes in 3.71:
        * Workaround for a VESA BIOS which tries to make DOS system
index 16fe772..7cd9ace 100644 (file)
@@ -30,6 +30,7 @@ allowoptions
 ontimeout
 onerror
 noescape
+nocomplete
 f0
 f1
 f2
index 973d15b..f563b9d 100644 (file)
@@ -75,6 +75,7 @@ keywd_table:
                keyword onerror,        pc_onerror
                keyword allowoptions,   pc_setint16,    AllowOptions
                keyword noescape,       pc_setint16,    NoEscape
+               keyword nocomplete,     pc_setint16,    NoComplete
                keyword f1,             pc_filename,    FKeyN(1)
                keyword f2,             pc_filename,    FKeyN(2)
                keyword f3,             pc_filename,    FKeyN(3)
index 4a38c35..55d6fbb 100644 (file)
@@ -463,6 +463,7 @@ OnerrorLen  dw 0                    ; Bytes in onerror command
 CmdLinePtr     dw cmd_line_here        ; Command line advancing pointer
 ForcePrompt    dw 0                    ; Force prompt
 NoEscape       dw 0                    ; No escape
+NoComplete     dw 0                    ; No label completion on TAB key
 AllowImplicit   dw 1                    ; Allow implicit kernels
 AllowOptions   dw 1                    ; User-specified options allowed
 IncludeLevel   dw 1                    ; Nesting level
index 26b6fa0..4f5b1fd 100644 (file)
@@ -108,6 +108,8 @@ enter_char: test byte [FuncFlag],1
 not_ascii:
                cmp al,0Dh                      ; Enter
                je command_done
+               cmp al,09h                      ; Tab
+               je display_labels
                cmp al,'F' & 1Fh                ; <Ctrl-F>
                je set_func_flag
 %if IS_PXELINUX
@@ -142,6 +144,49 @@ set_func_flag:
                mov byte [FuncFlag],1
                jmp short get_char_2
 
+display_labels:
+               cmp word [NoComplete],0         ; Label completion enabled?
+               jne get_char_2
+               push di                         ; Save pointer
+               mov cx,di
+               sub cx,command_line
+               call crlf
+               mov esi,[HighMemSize]           ; Start from top of memory
+.scan:
+               cmp esi,[VKernelEnd]
+               jbe .not_vk
+
+               push cx                         ; save command line size
+
+               mov di,VKernelBuf
+               call rllunpack
+               ; ESI updated on return
+
+               sub di,cx                       ; Return to beginning of buf
+               pop cx                          ; restore command line size
+               push si                         ; save SI
+               cmp cx,0
+               jz .print
+               push di
+               push cx
+               mov si,command_line
+               es repe cmpsb
+               pop cx
+               pop di
+               jne .next
+.print:
+               mov al,' '
+               call writechr
+
+               mov si,di
+               call writestr
+.next:
+               pop si                          ; restore SI
+               jmp .scan
+.not_vk:
+               call crlf
+               jmp fk_wrcmd
+
 ctrl_f:
                xor ah,ah
                mov [FuncFlag],ah
index 54be427..dd7608e 100644 (file)
@@ -399,6 +399,10 @@ NOESCAPE flag_val
        Lock escapes.  Use this (together with PROMPT 0) to force the
        default boot alternative.
 
+NOCOMPLETE flag_val
+       If flag_val is set to 1, the Tab key does not display labels
+       at the boot: prompt.
+
 F1 filename
 F2 filename
    ...etc...