@@ -66,42 +66,6 @@ func Init(e *Engine, highlighter func([]rune) string) {
6666 e .highlighter = highlighter
6767}
6868
69- // Refresh recomputes and redisplays the entire readline interface, except
70- // the first lines of the primary prompt when the latter is a multiline one.
71- func (e * Engine ) Refresh () {
72- fmt .Print (term .HideCursor )
73-
74- // Go back to the first column, and if the primary prompt
75- // was not printed yet, back up to the line's beginning row.
76- term .MoveCursorBackwards (term .GetWidth ())
77-
78- if ! e .primaryPrinted {
79- term .MoveCursorUp (e .cursorRow )
80- }
81-
82- // Print either all or the last line of the prompt.
83- e .prompt .LastPrint ()
84-
85- // Get all positions required for the redisplay to come:
86- // prompt end (thus indentation), cursor positions, etc.
87- e .computeCoordinates (true )
88-
89- // Print the line, and any of the secondary and right prompts.
90- e .displayLine ()
91- e .displayMultilinePrompts ()
92-
93- // Display hints and completions, go back
94- // to the start of the line, then to cursor.
95- helpersMoved := e .displayHelpers ()
96- if helpersMoved {
97- e .cursorHintToLineStart ()
98- e .lineStartToCursorPos ()
99- } else {
100- e .lineEndToCursorPos ()
101- }
102- fmt .Print (term .ShowCursor )
103- }
104-
10569// PrintPrimaryPrompt redraws the primary prompt.
10670// There are relatively few cases where you want to use this.
10771// It is currently only used when using clear-screen commands.
@@ -274,70 +238,6 @@ func (e *Engine) displayLine() {
274238 }
275239}
276240
277- func (e * Engine ) displayMultilinePrompts () {
278- // If we have more than one line, write the columns.
279- if e .line .Lines () > 1 {
280- term .MoveCursorUp (e .lineRows )
281- term .MoveCursorBackwards (term .GetWidth ())
282- e .prompt .MultilineColumnPrint ()
283- }
284-
285- // Then if we have a line at all, rewrite the last column
286- // character with any secondary prompt available.
287- if e .line .Lines () > 0 {
288- term .MoveCursorBackwards (term .GetWidth ())
289- e .prompt .SecondaryPrint ()
290- term .MoveCursorBackwards (term .GetWidth ())
291- term .MoveCursorForwards (e .lineCol )
292- }
293-
294- // Then prompt the right-sided prompt if possible.
295- e .prompt .RightPrint (e .lineCol , true )
296- }
297-
298- // displayHelpers renders the hint and completion sections.
299- // It assumes that the cursor is on the last line of input,
300- // and goes back to this same line after displaying this.
301- func (e * Engine ) displayHelpers () bool {
302- // Recompute completions and hints if autocompletion is on.
303- e .completer .Autocomplete ()
304-
305- hintRows := ui .CoordinatesHint (e .hint )
306- compMatches := e .completer .Matches ()
307- compSkip := e .completer .DisplaySkipped ()
308-
309- if e .hintRows == 0 && e .compRows == 0 && hintRows == 0 && (compMatches == 0 || compSkip ) {
310- return false
311- }
312-
313- fmt .Print (term .NewlineReturn )
314-
315- prevHintRows := e .hintRows
316- prevCompRows := e .compRows
317-
318- // Display hint and completions.
319- ui .DisplayHint (e .hint )
320- e .hintRows = ui .CoordinatesHint (e .hint )
321- if compMatches > 0 && ! compSkip {
322- completion .Display (e .completer , e .AvailableHelperLines ())
323- e .compRows = completion .Coordinates (e .completer )
324- } else {
325- e .completer .ResetUsedRows ()
326- e .compRows = 0
327- }
328-
329- if e .hintRows + e .compRows < prevHintRows + prevCompRows {
330- fmt .Print (term .ClearScreenBelow )
331- }
332-
333- // Go back to the first line below the input line.
334- term .MoveCursorBackwards (term .GetWidth ())
335- term .MoveCursorUp (e .compRows )
336- term .MoveCursorUp (e .hintRows )
337-
338- return true
339- }
340-
341241// lineEndToCursorPos moves the cursor from the end of the input line
342242// to the current cursor position.
343243func (e * Engine ) lineEndToCursorPos () {
0 commit comments