Skip to content

Commit

Permalink
fix(compatibility): do not duplicate bracketed paste in chunked stdin…
Browse files Browse the repository at this point in the history
… input (#917)

* debug message

* fix attempt

* oops

* remove log message

* rustfmt

* style(clippy): make clippy happy

* style(clippy): make clippy happy again!
  • Loading branch information
imsnif authored Dec 2, 2021
1 parent 180aa78 commit cbe0d54
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 43 deletions.
14 changes: 13 additions & 1 deletion zellij-client/src/stdin_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,20 @@ pub(crate) fn stdin_loop(
pasting = false;
}
None => {
let starts_with_bracketed_paste_start = stdin_buffer
.iter()
.take(bracketed_paste_start.len())
.eq(bracketed_paste_start.iter());
if starts_with_bracketed_paste_start {
drop(stdin_buffer.drain(..6)); // bracketed paste start
}

send_input_instructions
.send(InputInstruction::PastedText((true, stdin_buffer, false)))
.send(InputInstruction::PastedText((
starts_with_bracketed_paste_start,
stdin_buffer,
false,
)))
.unwrap();
pasting = true;
continue;
Expand Down
21 changes: 1 addition & 20 deletions zellij-server/src/panes/terminal_character.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ impl NamedColor {
}
}

#[derive(Clone, Copy, Debug, PartialEq)]
#[derive(Clone, Copy, Debug, PartialEq, Default)]
pub struct CharacterStyles {
pub foreground: Option<AnsiCode>,
pub background: Option<AnsiCode>,
Expand All @@ -125,25 +125,6 @@ pub struct CharacterStyles {
pub link_anchor: Option<LinkAnchor>,
}

impl Default for CharacterStyles {
fn default() -> Self {
Self {
foreground: None,
background: None,
strike: None,
hidden: None,
reverse: None,
slow_blink: None,
fast_blink: None,
underline: None,
bold: None,
dim: None,
italic: None,
link_anchor: None,
}
}
}

impl CharacterStyles {
pub fn new() -> Self {
Self::default()
Expand Down
2 changes: 1 addition & 1 deletion zellij-server/src/tab.rs
Original file line number Diff line number Diff line change
Expand Up @@ -946,7 +946,7 @@ impl Tab {
.or_insert_with(|| Boundaries::new(self.viewport));
pane_contents_and_ui.render_pane_boundaries(
*client_id,
&mut boundaries,
boundaries,
self.session_is_mirrored,
);
}
Expand Down
10 changes: 1 addition & 9 deletions zellij-server/src/ui/overlay/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,19 +44,11 @@ impl Overlayable for OverlayType {
/// Entrypoint from [`Screen`], which holds the context in which
/// the overlays are being rendered.
/// The most recent overlays draw over the previous overlays.
#[derive(Clone, Debug)]
#[derive(Clone, Debug, Default)]
pub struct OverlayWindow {
pub overlay_stack: Vec<Overlay>,
}

impl Default for OverlayWindow {
fn default() -> Self {
Self {
overlay_stack: vec![],
}
}
}

impl Overlayable for OverlayWindow {
fn generate_overlay(&self, size: Size) -> String {
let mut output = String::new();
Expand Down
13 changes: 1 addition & 12 deletions zellij-utils/src/input/layout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ pub struct LayoutFromYamlIntermediate {

// The struct that is used to deserialize the layout from
// a yaml configuration file
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Default)]
#[serde(crate = "self::serde")]
#[serde(default)]
pub struct LayoutFromYaml {
Expand Down Expand Up @@ -775,17 +775,6 @@ impl Default for LayoutTemplate {
}
}

impl Default for LayoutFromYaml {
fn default() -> Self {
Self {
session: SessionFromYaml::default(),
template: LayoutTemplate::default(),
borderless: false,
tabs: vec![],
}
}
}

impl Default for Direction {
fn default() -> Self {
Direction::Horizontal
Expand Down

0 comments on commit cbe0d54

Please sign in to comment.