MCPcopy Create free account
hub / github.com/NetHack/NetHack / topl_key

Function topl_key

outdated/sys/mac/macwin.c:1074–1121  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1072}
1073
1074Boolean
1075topl_key(unsigned char ch, Boolean ext)
1076{
1077 switch (ch) {
1078 case CHAR_ESC:
1079 topl_replace("\x1b");
1080 case CHAR_ENTER:
1081 case CHAR_CR:
1082 case CHAR_LF:
1083 return false;
1084
1085 case 0x1f & 'P':
1086 mac_doprev_message();
1087 return true;
1088 case '\x1e' /* up arrow */:
1089 topl_replace("");
1090 return true;
1091 case CHAR_BS:
1092 case '\x1c' /* left arrow */:
1093 if ((*top_line)->selEnd <= topl_query_len)
1094 return true;
1095 else if (ext) {
1096 topl_replace("");
1097 return true;
1098 }
1099 default:
1100 TEKey(ch, top_line);
1101 if (ext) {
1102 int com_index = -1, oindex = 0;
1103 while (extcmdlist[oindex].ef_txt != (char *) 0) {
1104 if (!strncmpi(*(*top_line)->hText + topl_query_len,
1105 extcmdlist[oindex].ef_txt,
1106 (*top_line)->teLength - topl_query_len)) {
1107 if (com_index == -1) /* No matches yet*/
1108 com_index = oindex;
1109 else /* More than 1 match */ {
1110 com_index = -2;
1111 break;
1112 }
1113 }
1114 oindex++;
1115 }
1116 if (com_index >= 0)
1117 topl_replace((char *) extcmdlist[com_index].ef_txt);
1118 }
1119 return true;
1120 }
1121}
1122
1123static void
1124topl_flash_resp(int resp_idx)

Callers 1

topl_getlinFunction · 0.85

Calls 3

topl_replaceFunction · 0.85
mac_doprev_messageFunction · 0.85
strncmpiFunction · 0.50

Tested by

no test coverage detected