[syslinux] [PATCH] ui: label completion on tab key

Sebastian Herbszt herbszt at gmx.de
Sun Jul 20 09:15:52 PDT 2008


I tired to implement this idea and it seems to work, but i have only tested it
with syslinux. 
If you press tab with an empty command line it will display all labels. If the
command line contains any characters it will display the matching labels.

This patch is only intended for testing since i didn't check if it doesn't
clobber required registers. Feedback welcome.

- Sebastian

Index: syslinux-3.71-pre15/core/ui.inc
===================================================================
--- syslinux-3.71-pre15.orig/core/ui.inc	2008-07-20 15:09:50.000000000 +0200
+++ syslinux-3.71-pre15/core/ui.inc	2008-07-20 17:10:51.000000000 +0200
@@ -108,6 +108,8 @@
 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,46 @@
 		mov byte [FuncFlag],1
 		jmp short get_char_2
 
+display_labels:
+		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 enter_command
+
 ctrl_f:
 		xor ah,ah
 		mov [FuncFlag],ah




More information about the Syslinux mailing list