cmdr
Check-in [defa6f6ead]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Fix small issue, clear header in a multi-line prompt, this is a fixed part we must not redraw on retry under this new scheme.
Timelines: family | ancestors | descendants | both | say-more
Files: files | file ages | folders
SHA1: defa6f6eadca9a5dd1b76defe8588fd4cff05c32
User & Date: andreask 2015-04-22 20:19:52.847
Context
2015-04-22
20:42
Split the example file into many, and moved into the proper section. check-in: d1f3c1d5ee user: andreask tags: say-more
20:19
Fix small issue, clear header in a multi-line prompt, this is a fixed part we must not redraw on retry under this new scheme. check-in: defa6f6ead user: andreask tags: say-more
20:13
Worked the low-level output into the ask package as demo of use. Especially made the retry loops visually tighter (temp display of error on bad input, plus reuse of existing line for re-input, no redraw of fixed parts (headers, menu listings)). check-in: 4f4b8b9a82 user: andreask tags: say-more
Changes
Unified Diff Ignore Whitespace Patch
Changes to ask.tcl.
166
167
168
169
170
171
172




173
174
175
176
177
178
179

	# Show error for a second, then move back to the interaction
	# line and retry (which overwrites the old string).
	say add [color bad [Wrap "You must choose \"yes\" or \"no\""]]
	after 1000
	say rewind
	say up




    }

    return $response
}

proc ::cmdr::ask::choose {query choices {default {}}} {
    debug.cmdr/ask {}







>
>
>
>







166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183

	# Show error for a second, then move back to the interaction
	# line and retry (which overwrites the old string).
	say add [color bad [Wrap "You must choose \"yes\" or \"no\""]]
	after 1000
	say rewind
	say up

	# Clear header to prevent redisplay, this part is fixed above
	# the actual input line.
	set header {}
    }

    return $response
}

proc ::cmdr::ask::choose {query choices {default {}}} {
    debug.cmdr/ask {}
211
212
213
214
215
216
217




218
219
220
221
222
223
224

	# Show error for a second, then move back to the interaction
	# line and retry (which overwrites the old string).
	say add [color bad [Wrap "You must choose one of $lc"]]
	after 1000
	say rewind
	say up




    }

    return $response
}

proc ::cmdr::ask::menu {header prompt choices {default {}}} {
    debug.cmdr/ask {}







>
>
>
>







215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232

	# Show error for a second, then move back to the interaction
	# line and retry (which overwrites the old string).
	say add [color bad [Wrap "You must choose one of $lc"]]
	after 1000
	say rewind
	say up

	# Clear header to prevent redisplay, this part is fixed above
	# the actual input line.
	set header {}
    }

    return $response
}

proc ::cmdr::ask::menu {header prompt choices {default {}}} {
    debug.cmdr/ask {}
282
283
284
285
286
287
288




289
290
291
292
293
294
295

	# Show error for a second, then move back to the interaction
	# line and retry (which overwrites the old string).
	say add [color bad [Wrap "You must choose one of the above"]]
	after 1000
	say rewind
	say up




    }

    return $response
}

# # ## ### ##### ######## ############# #####################








>
>
>
>







290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307

	# Show error for a second, then move back to the interaction
	# line and retry (which overwrites the old string).
	say add [color bad [Wrap "You must choose one of the above"]]
	after 1000
	say rewind
	say up

	# Clear header to prevent redisplay, this part is fixed above
	# the actual input line.
	set pheader {}
    }

    return $response
}

# # ## ### ##### ######## ############# #####################