From 0fc070298332ad979d6cfd9f8f79782f758df346 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Fri, 12 Feb 2016 13:53:54 +0000 Subject: [PATCH] indentwidth can actually take 0 as a parameter --- src/main.cc | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/main.cc b/src/main.cc index e846dfbc..1640c504 100644 --- a/src/main.cc +++ b/src/main.cc @@ -178,10 +178,14 @@ void register_registers() register_manager.add_register('_', make_unique()); } -static void check_positive(const int& val) +static void check_tabstop(const int& val) { - if (val < 1) - throw runtime_error{"value should be strictly positive"}; + if (val < 1) throw runtime_error{"tabstop should be strictly positive"}; +} + +static void check_indentwidth(const int& val) +{ + if (val < 0) throw runtime_error{"indentwidth should be positive or zero"}; } static void check_scrolloff(const CharCoord& so) @@ -194,8 +198,8 @@ void register_options() { OptionsRegistry& reg = GlobalScope::instance().option_registry(); - reg.declare_option("tabstop", "size of a tab character", 8); - reg.declare_option("indentwidth", "indentation width", 4); + reg.declare_option("tabstop", "size of a tab character", 8); + reg.declare_option("indentwidth", "indentation width", 4); reg.declare_option( "scrolloff", "number of lines and columns to keep visible main cursor when scrolling", {0,0});