* On paste, the TerminalViewModel uses the ShellProfile to translate line endings. Default line ending translation style is set to not modify the pasted contents, Next up, adding the radio button to shell profile. * Added UI elements for choosing line ending style. Using a converter to map between an enum and radio buttons, and another converter to map from enum to text based on the description of the enum value. * Added "Paste without newlines" command. * Adding missing converters to project file. * A few fixes after cherry-picks. * Adding missing Command property to PasteWithoutNewlines keybinding. * Cleaned up some unnecessary property settings. * fix #114 scrolling issue on presicion touchpads (#171) * fix #114 scrolling issue on presicion touchpads, bounce scroll & pinch zoom * rephrased comment * removed css that enforced autohiding * simplified js code handling scrollbar size * Press enter to close an Input dialog (#177) ... As if the primary button is pressed. * Renew certificate * Update README.md * Add option to use bold text in terminals (#183) * Add option to use bold text in terminals ... as per #182 * Add BoldText to setting defaults * Remove AppVeyor files * Update README.md * Add keybinding to change the (current) tab title (#193) * Add keybinding for change the (current) tab title Default binding is Ctrl+Shift+N * Update change tab title default keybind to Ctrl+Shift+R * Experimental ConPTY support (#199) * First steps of ConPty support * Added resize functionality * fix cwd, args, hide console window * Handle shell process exited * Make ConPTY optional * Fix automerge errors * Accepted many XAML formatting changes, and changed command handling to switch. * Fixed spaxcng on the settings page. * adapted radio button binding to be in line with the rest of the application
61 lines
2.1 KiB
C#
61 lines
2.1 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Text.RegularExpressions;
|
|
using FluentTerminal.Models.Enums;
|
|
using System.Linq;
|
|
|
|
namespace FluentTerminal.Models
|
|
{
|
|
public class ShellProfile
|
|
{
|
|
/// <summary>
|
|
/// Replace all instances of anything resembling a newline, treating pairs of \r\n in either order as a single linebreak.
|
|
/// </summary>
|
|
public static Regex NewlinePattern = new Regex(@"\n\r|\r\n|\r|\n", RegexOptions.Compiled);
|
|
|
|
public ShellProfile()
|
|
{
|
|
|
|
}
|
|
|
|
public ShellProfile(ShellProfile other)
|
|
{
|
|
Id = other.Id;
|
|
PreInstalled = other.PreInstalled;
|
|
Name = other.Name;
|
|
Arguments = other.Arguments;
|
|
Location = other.Location;
|
|
WorkingDirectory = other.WorkingDirectory;
|
|
TabThemeId = other.TabThemeId;
|
|
TerminalThemeId = other.TerminalThemeId;
|
|
LineEndingTranslation = other.LineEndingTranslation;
|
|
KeyBindings = other.KeyBindings.Select(x => new KeyBinding(x)).ToList();
|
|
}
|
|
|
|
public Guid Id { get; set; }
|
|
public bool PreInstalled { get; set; }
|
|
public string Name { get; set; }
|
|
public string Arguments { get; set; }
|
|
public string Location { get; set; }
|
|
public string WorkingDirectory { get; set; }
|
|
public int TabThemeId { get; set; }
|
|
public LineEndingStyle LineEndingTranslation { get; set; }
|
|
|
|
public string TranslateLineEndings(string content)
|
|
{
|
|
switch (LineEndingTranslation)
|
|
{
|
|
case LineEndingStyle.ToCRLF:
|
|
return NewlinePattern.Replace(content, "\r\n");
|
|
case LineEndingStyle.ToLF:
|
|
return NewlinePattern.Replace(content, "\n");
|
|
case LineEndingStyle.DoNotModify:
|
|
default:
|
|
return content;
|
|
}
|
|
}
|
|
|
|
public Guid TerminalThemeId { get; set; }
|
|
public ICollection<KeyBinding> KeyBindings { get; set; } = new List<KeyBinding>();
|
|
}
|
|
} |