Skip to content

Commit

Permalink
dev (#49)
Browse files Browse the repository at this point in the history
* Load default options

* fix stupid

* Fix clearline after input buffer

* Change UNIX newlines with returned newlines in display (more reliable)

* Always use original terminal file descriptor for low-level cursor
requests, and potentially most other virtual terminal sequences.

* Don't code too late in the night
  • Loading branch information
maxlandon authored Jun 5, 2023
1 parent 915d7e5 commit a83d6ec
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions internal/display/engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package display

import (
"fmt"
"os"

"github.com/reeflective/readline/inputrc"
"github.com/reeflective/readline/internal/color"
Expand Down Expand Up @@ -33,7 +32,6 @@ type Engine struct {
hintRows int
compRows int
primaryPrinted bool
termFd uintptr

// UI components
keys *core.Keys
Expand All @@ -51,7 +49,6 @@ type Engine struct {
// NewEngine is a required constructor for the display engine.
func NewEngine(k *core.Keys, s *core.Selection, h *history.Sources, p *ui.Prompt, i *ui.Hint, c *completion.Engine, opts *inputrc.Config) *Engine {
return &Engine{
termFd: os.Stdout.Fd(),
keys: k,
selection: s,
histories: h,
Expand Down Expand Up @@ -296,7 +293,7 @@ func (e *Engine) displayHelpers() {
// AvailableHelperLines returns the number of lines available below the hint section.
// It returns half the terminal space if we currently have less than 1/3rd of it below.
func (e *Engine) AvailableHelperLines() int {
_, termHeight, _ := term.GetSize(int(e.termFd))
termHeight := term.GetLength()
compLines := termHeight - e.startRows - e.lineRows - e.hintRows

if compLines < (termHeight / oneThirdTerminalHeight) {
Expand Down

0 comments on commit a83d6ec

Please sign in to comment.