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

add .svn as workspace-root marker #11426

Closed
wants to merge 2 commits into from
Closed
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
1 change: 1 addition & 0 deletions book/src/editor.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
|--|--|---------|
| `scrolloff` | Number of lines of padding around the edge of the screen when scrolling | `5` |
| `mouse` | Enable mouse mode | `true` |
| `default-register` | Default register used for yank/paste. | '"' |
| `middle-click-paste` | Middle click paste support | `true` |
| `scroll-lines` | Number of lines to scroll per scroll wheel step | `3` |
| `shell` | Shell to use when running external commands | Unix: `["sh", "-c"]`<br/>Windows: `["cmd", "/C"]` |
Expand Down
4 changes: 2 additions & 2 deletions helix-loader/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -225,13 +225,13 @@ pub fn merge_toml_values(left: toml::Value, right: toml::Value, merge_depth: usi
/// Used as a ceiling dir for LSP root resolution, the filepicker and potentially as a future filewatching root
///
/// This function starts searching the FS upward from the CWD
/// and returns the first directory that contains either `.git` or `.helix`.
/// and returns the first directory that contains either `.git`, `.svn` or `.helix`.
/// If no workspace was found returns (CWD, true).
/// Otherwise (workspace, false) is returned
pub fn find_workspace() -> (PathBuf, bool) {
let current_dir = current_working_dir();
for ancestor in current_dir.ancestors() {
if ancestor.join(".git").exists() || ancestor.join(".helix").exists() {
if ancestor.join(".git").exists() || ancestor.join(".svn").exists() || ancestor.join(".helix").exists() {
return (ancestor.to_owned(), false);
}
}
Expand Down
25 changes: 18 additions & 7 deletions helix-term/src/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2655,7 +2655,7 @@ fn delete_selection_impl(cx: &mut Context, op: Operation, yank: YankAction) {
// yank the selection
let text = doc.text().slice(..);
let values: Vec<String> = selection.fragments(text).map(Cow::into_owned).collect();
let reg_name = cx.register.unwrap_or('"');
let reg_name = cx.register.unwrap_or(&cx.editor.config().default_register);
if let Err(err) = cx.editor.registers.write(reg_name, values) {
cx.editor.set_error(err.to_string());
return;
Expand Down Expand Up @@ -4097,7 +4097,10 @@ fn commit_undo_checkpoint(cx: &mut Context) {
// Yank / Paste

fn yank(cx: &mut Context) {
yank_impl(cx.editor, cx.register.unwrap_or('"'));
yank_impl(
cx.editor,
cx.register.unwrap_or(&cx.editor.config().default_register),
);
exit_select_mode(cx);
}

Expand Down Expand Up @@ -4158,7 +4161,11 @@ fn yank_joined_impl(editor: &mut Editor, separator: &str, register: char) {

fn yank_joined(cx: &mut Context) {
let separator = doc!(cx.editor).line_ending.as_str();
yank_joined_impl(cx.editor, separator, cx.register.unwrap_or('"'));
yank_joined_impl(
cx.editor,
separator,
cx.register.unwrap_or(&cx.editor.config().default_register),
);
exit_select_mode(cx);
}

Expand Down Expand Up @@ -4314,7 +4321,11 @@ fn paste_primary_clipboard_before(cx: &mut Context) {
}

fn replace_with_yanked(cx: &mut Context) {
replace_with_yanked_impl(cx.editor, cx.register.unwrap_or('"'), cx.count());
replace_with_yanked_impl(
cx.editor,
cx.register.unwrap_or(&cx.editor.config().default_register),
cx.count(),
);
exit_select_mode(cx);
}

Expand Down Expand Up @@ -4377,7 +4388,7 @@ fn paste(editor: &mut Editor, register: char, pos: Paste, count: usize) {
fn paste_after(cx: &mut Context) {
paste(
cx.editor,
cx.register.unwrap_or('"'),
cx.register.unwrap_or(&cx.editor.config().default_register),
Paste::After,
cx.count(),
);
Expand All @@ -4387,7 +4398,7 @@ fn paste_after(cx: &mut Context) {
fn paste_before(cx: &mut Context) {
paste(
cx.editor,
cx.register.unwrap_or('"'),
cx.register.unwrap_or(&cx.editor.config().default_register),
Paste::Before,
cx.count(),
);
Expand Down Expand Up @@ -5208,7 +5219,7 @@ fn insert_register(cx: &mut Context) {
cx.register = Some(ch);
paste(
cx.editor,
cx.register.unwrap_or('"'),
cx.register.unwrap_or(&cx.editor.config().default_register),
Paste::Cursor,
cx.count(),
);
Expand Down
3 changes: 3 additions & 0 deletions helix-view/src/editor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,8 @@ pub struct Config {
pub auto_completion: bool,
/// Automatic formatting on save. Defaults to true.
pub auto_format: bool,
/// Default register used for yank/paste. Defaults to '"'
pub default_register: char,
/// Automatic save on focus lost and/or after delay.
/// Time delay in milliseconds since last edit after which auto save timer triggers.
/// Time delay defaults to false with 3000ms delay. Focus lost defaults to false.
Expand Down Expand Up @@ -945,6 +947,7 @@ impl Default for Config {
auto_pairs: AutoPairConfig::default(),
auto_completion: true,
auto_format: true,
default_register: '"',
auto_save: AutoSave::default(),
idle_timeout: Duration::from_millis(250),
completion_timeout: Duration::from_millis(250),
Expand Down