feat(term): implement copy_all()

Implements the copy_all() method which copies all text in the screen
including text in the scrollback buffer.

Includes a fix to an upstream bug in libtsm that resulted in double the
number of '\n' characters being copied for each row.
This commit is contained in:
Leroy Hopson 2024-03-03 20:27:59 +13:00
parent 8255d8b3ce
commit 71df1e71bd
No known key found for this signature in database
GPG key ID: D2747312A6DB51AA
5 changed files with 56 additions and 14 deletions

View file

@ -3,7 +3,8 @@
#pragma once
#include<map>
#include <functional>
#include <map>
#include <godot_cpp/classes/control.hpp>
#include <godot_cpp/classes/image_texture.hpp>
@ -71,6 +72,7 @@ namespace godot
void set_blink_off_time(const double p_blink_off_time);
double get_blink_off_time() const;
String copy_all();
String copy_selection();
void set_copy_on_selection(const bool p_enable);
bool get_copy_on_selection() const;
@ -170,6 +172,9 @@ namespace godot
Timer *selection_timer;
void _handle_selection(Ref<InputEventMouse> event);
void _on_selection_held();
typedef std::function<int(struct tsm_screen*, char**)> ScreenCopyFunction;
String _copy_screen(ScreenCopyFunction func);
};
} // namespace godot