-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[lldb] Implement a statusline in LLDB #121860
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
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
1352444
[lldb] Implement a statusline in LLDB
JDevlieghere b467289
Merge branch 'main' into statusline
JDevlieghere 5678492
Redraw the statusline when editline has taken control of the screen
JDevlieghere 0b22fb3
Address David's feedback
JDevlieghere 74417cc
[lldb] Rewrite stripping and padding and add a unit test
JDevlieghere 9e36480
Fix spurious newline bug
JDevlieghere 0c612ee
Merge remote-tracking branch 'origin/main' into statusline
JDevlieghere 5439bf0
Use ansi::TrimAndPad
JDevlieghere File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
//===-- Statusline.h -----------------------------------------------------===// | ||
// | ||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
// See https://llvm.org/LICENSE.txt for license information. | ||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#ifndef LLDB_CORE_STATUSLINE_H | ||
#define LLDB_CORE_STATUSLINE_H | ||
|
||
#include "lldb/lldb-forward.h" | ||
#include "llvm/ADT/StringRef.h" | ||
#include <csignal> | ||
#include <cstdint> | ||
#include <string> | ||
|
||
namespace lldb_private { | ||
class Statusline { | ||
public: | ||
Statusline(Debugger &debugger); | ||
~Statusline(); | ||
|
||
/// Reduce the scroll window and draw the statusline. | ||
void Enable(); | ||
|
||
/// Hide the statusline and extend the scroll window. | ||
void Disable(); | ||
|
||
/// Redraw the statusline. If update is false, this will redraw the last | ||
/// string. | ||
void Redraw(bool update = true); | ||
|
||
/// Inform the statusline that the terminal dimensions have changed. | ||
void TerminalSizeChanged(); | ||
|
||
protected: | ||
/// Pad and trim the given string to fit to the given width. | ||
static std::string TrimAndPad(std::string str, size_t width); | ||
|
||
private: | ||
/// Draw the statusline with the given text. | ||
void Draw(std::string msg); | ||
|
||
/// Update terminal dimensions. | ||
void UpdateTerminalProperties(); | ||
|
||
enum ScrollWindowMode { | ||
ScrollWindowExtend, | ||
ScrollWindowShrink, | ||
}; | ||
|
||
/// Set the scroll window for the given mode. | ||
void UpdateScrollWindow(ScrollWindowMode mode); | ||
|
||
/// Clear the statusline (without redrawing the background). | ||
void Reset(); | ||
|
||
Debugger &m_debugger; | ||
std::string m_last_str; | ||
|
||
volatile std::sig_atomic_t m_terminal_size_has_changed = 1; | ||
uint64_t m_terminal_width = 0; | ||
uint64_t m_terminal_height = 0; | ||
}; | ||
} // namespace lldb_private | ||
#endif // LLDB_CORE_STATUSLINE_H |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.