Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds toggle for disabling Autocomplete from automatically popping up. #1

Merged
merged 3 commits into from
Aug 13, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions edbee-lib/edbee/models/texteditorconfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,21 @@ void TextEditorConfig::setShowWhitespaceMode(const QString& str)
}
}

/// Sets whether autocomplete comes up automatically, or only manually(manual trigger isn't implemented yet)
/// @see TextEditorConfig::autocompleteAutoShow
void TextEditorConfig::setAutocompleteAutoShow(bool enable)
{
if( autocompleteAutoShow_ != enable ) {
autocompleteAutoShow_ = enable;
notifyChange();
}
}

/// Show autocomplete automatically, or only manually(manual isn't implemented yet)
bool TextEditorConfig::autocompleteAutoShow() const
{
return autocompleteAutoShow_;
}

/// This internal method is used to notify the listener that a change has happend
/// Thi smethod only emits a signal if there's no config group change busy
Expand Down
5 changes: 5 additions & 0 deletions edbee-lib/edbee/models/texteditorconfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ Q_OBJECT
void setShowWhitespaceMode( int mode );
void setShowWhitespaceMode( const QString& str );

bool autocompleteAutoShow() const;
void setAutocompleteAutoShow( bool enable );


signals:
void configChanged();
Expand Down Expand Up @@ -118,6 +121,8 @@ Q_OBJECT

bool scrollPastEnd_; ///< Should the last line of the document be scrollable to the top of the window
int showWhitespaceMode_; ///< The current whitespace mode to make

bool autocompleteAutoShow_; ///< Show autocomplete automatically, or only when manually triggered
};

} // edbee
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,11 @@ void TextEditorAutoCompleteComponent::updateList()
TextDocument* doc = controller()->textDocument();
TextRange range = controller()->textSelection()->range(0);

if (!isVisible() && !doc->config()->autocompleteAutoShow())
{
return;
}

// when the character after
if(!shouldDisplayAutoComplete(range, currentWord_)) {
menuRef_->close();
Expand Down