summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoryokota <yokota@FreeBSD.org>1998-01-09 09:06:55 +0000
committeryokota <yokota@FreeBSD.org>1998-01-09 09:06:55 +0000
commitc7fe61947cc8a2c1ddb9004852594b9f47121adc (patch)
tree73bd591fb966f24751916215f6eb69cad52d9c0e
parentc1a394c6e7521487034760c43d99d6cf4c7c368a (diff)
downloadFreeBSD-src-c7fe61947cc8a2c1ddb9004852594b9f47121adc.zip
FreeBSD-src-c7fe61947cc8a2c1ddb9004852594b9f47121adc.tar.gz
- Produce the accent letter if the user hits the accent key twice.
(accent_key + space does still print the accent letter too, as in the previous commit.) Requested by a couple of users. - Clear the accent flag when the next_screen key is pressed. - Added some comment lines regarding accent key processing.
-rw-r--r--sys/dev/syscons/syscons.c32
-rw-r--r--sys/i386/isa/syscons.c32
-rw-r--r--sys/isa/syscons.c32
3 files changed, 84 insertions, 12 deletions
diff --git a/sys/dev/syscons/syscons.c b/sys/dev/syscons/syscons.c
index 85dbdc9..6862fd9 100644
--- a/sys/dev/syscons/syscons.c
+++ b/sys/dev/syscons/syscons.c
@@ -25,7 +25,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $Id: syscons.c,v 1.242 1997/12/07 08:09:19 yokota Exp $
+ * $Id: syscons.c,v 1.243 1998/01/07 08:40:34 yokota Exp $
*/
#include "sc.h"
@@ -3760,6 +3760,7 @@ next_code:
case NEXT:
{
int next, this = get_scr_num();
+ accents = 0;
for (next = this+1; next != this; next = (next+1)%MAXCONS) {
struct tty *tp = VIRTUAL_TTY(next);
if (tp->t_state & TS_ISOPEN) {
@@ -3774,11 +3775,30 @@ next_code:
return(BKEY);
default:
if (action >= F_ACC && action <= L_ACC) {
- accents = action - F_ACC + 1;
- if (accent_map.acc[accents - 1].accchar == 0) {
+ /* turn it into an index */
+ action -= F_ACC - 1;
+ if ((action > accent_map.n_accs)
+ || (accent_map.acc[action - 1].accchar == 0)) {
+ /*
+ * The index is out of range or pointing to an
+ * empty entry.
+ */
accents = 0;
do_bell(cur_console, BELL_PITCH, BELL_DURATION);
}
+ /*
+ * If the same accent key has been hit twice,
+ * produce the accent char itself.
+ */
+ if (action == accents) {
+ action = accent_map.acc[accents - 1].accchar;
+ accents = 0;
+ if (metas)
+ action |= MKEY;
+ return (action);
+ }
+ /* remember the index and wait for the next key stroke */
+ accents = action;
break;
}
if (accents > 0) {
@@ -3801,6 +3821,10 @@ next_code:
acc = &accent_map.acc[accents - 1];
accents = 0;
+ /*
+ * If the accent key is followed by the space key,
+ * produce the accent char itself.
+ */
if (action == ' ') {
action = acc->accchar;
if (metas)
@@ -3808,7 +3832,7 @@ next_code:
return (action);
}
for (i = 0; i < NUM_ACCENTCHARS; ++i) {
- if (acc->map[i][0] == 0)
+ if (acc->map[i][0] == 0) /* end of the map entry */
break;
if (acc->map[i][0] == action) {
action = acc->map[i][1];
diff --git a/sys/i386/isa/syscons.c b/sys/i386/isa/syscons.c
index 85dbdc9..6862fd9 100644
--- a/sys/i386/isa/syscons.c
+++ b/sys/i386/isa/syscons.c
@@ -25,7 +25,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $Id: syscons.c,v 1.242 1997/12/07 08:09:19 yokota Exp $
+ * $Id: syscons.c,v 1.243 1998/01/07 08:40:34 yokota Exp $
*/
#include "sc.h"
@@ -3760,6 +3760,7 @@ next_code:
case NEXT:
{
int next, this = get_scr_num();
+ accents = 0;
for (next = this+1; next != this; next = (next+1)%MAXCONS) {
struct tty *tp = VIRTUAL_TTY(next);
if (tp->t_state & TS_ISOPEN) {
@@ -3774,11 +3775,30 @@ next_code:
return(BKEY);
default:
if (action >= F_ACC && action <= L_ACC) {
- accents = action - F_ACC + 1;
- if (accent_map.acc[accents - 1].accchar == 0) {
+ /* turn it into an index */
+ action -= F_ACC - 1;
+ if ((action > accent_map.n_accs)
+ || (accent_map.acc[action - 1].accchar == 0)) {
+ /*
+ * The index is out of range or pointing to an
+ * empty entry.
+ */
accents = 0;
do_bell(cur_console, BELL_PITCH, BELL_DURATION);
}
+ /*
+ * If the same accent key has been hit twice,
+ * produce the accent char itself.
+ */
+ if (action == accents) {
+ action = accent_map.acc[accents - 1].accchar;
+ accents = 0;
+ if (metas)
+ action |= MKEY;
+ return (action);
+ }
+ /* remember the index and wait for the next key stroke */
+ accents = action;
break;
}
if (accents > 0) {
@@ -3801,6 +3821,10 @@ next_code:
acc = &accent_map.acc[accents - 1];
accents = 0;
+ /*
+ * If the accent key is followed by the space key,
+ * produce the accent char itself.
+ */
if (action == ' ') {
action = acc->accchar;
if (metas)
@@ -3808,7 +3832,7 @@ next_code:
return (action);
}
for (i = 0; i < NUM_ACCENTCHARS; ++i) {
- if (acc->map[i][0] == 0)
+ if (acc->map[i][0] == 0) /* end of the map entry */
break;
if (acc->map[i][0] == action) {
action = acc->map[i][1];
diff --git a/sys/isa/syscons.c b/sys/isa/syscons.c
index 85dbdc9..6862fd9 100644
--- a/sys/isa/syscons.c
+++ b/sys/isa/syscons.c
@@ -25,7 +25,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $Id: syscons.c,v 1.242 1997/12/07 08:09:19 yokota Exp $
+ * $Id: syscons.c,v 1.243 1998/01/07 08:40:34 yokota Exp $
*/
#include "sc.h"
@@ -3760,6 +3760,7 @@ next_code:
case NEXT:
{
int next, this = get_scr_num();
+ accents = 0;
for (next = this+1; next != this; next = (next+1)%MAXCONS) {
struct tty *tp = VIRTUAL_TTY(next);
if (tp->t_state & TS_ISOPEN) {
@@ -3774,11 +3775,30 @@ next_code:
return(BKEY);
default:
if (action >= F_ACC && action <= L_ACC) {
- accents = action - F_ACC + 1;
- if (accent_map.acc[accents - 1].accchar == 0) {
+ /* turn it into an index */
+ action -= F_ACC - 1;
+ if ((action > accent_map.n_accs)
+ || (accent_map.acc[action - 1].accchar == 0)) {
+ /*
+ * The index is out of range or pointing to an
+ * empty entry.
+ */
accents = 0;
do_bell(cur_console, BELL_PITCH, BELL_DURATION);
}
+ /*
+ * If the same accent key has been hit twice,
+ * produce the accent char itself.
+ */
+ if (action == accents) {
+ action = accent_map.acc[accents - 1].accchar;
+ accents = 0;
+ if (metas)
+ action |= MKEY;
+ return (action);
+ }
+ /* remember the index and wait for the next key stroke */
+ accents = action;
break;
}
if (accents > 0) {
@@ -3801,6 +3821,10 @@ next_code:
acc = &accent_map.acc[accents - 1];
accents = 0;
+ /*
+ * If the accent key is followed by the space key,
+ * produce the accent char itself.
+ */
if (action == ' ') {
action = acc->accchar;
if (metas)
@@ -3808,7 +3832,7 @@ next_code:
return (action);
}
for (i = 0; i < NUM_ACCENTCHARS; ++i) {
- if (acc->map[i][0] == 0)
+ if (acc->map[i][0] == 0) /* end of the map entry */
break;
if (acc->map[i][0] == action) {
action = acc->map[i][1];
OpenPOWER on IntegriCloud