>From 783703cda4361c558606a9e29f182fe3e385c2a0 Mon Sep 17 00:00:00 2001
From: Dima Kogan <dima@secretsauce.net>
Date: Wed, 3 Oct 2012 01:20:02 -0700
Subject: [PATCH] inboard X11 terminal now suppresses duplicate consecutive V
 commands

---
 term/x11.trm |   13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/term/x11.trm b/term/x11.trm
index e16fcd1..73e615c 100644
--- a/term/x11.trm
+++ b/term/x11.trm
@@ -1487,7 +1487,20 @@ X11_move(unsigned int x, unsigned int y)
 TERM_PUBLIC void
 X11_vector(unsigned int x, unsigned int y)
 {
+    /* I detect identical consecutive V commands, and do not send duplicates.
+       This can net a huge efficiency gain if we're plotting lines finer than
+       the window resolution */
+    static unsigned int xy_last[2];
+    static long ftell_last = -1;
+
+    if( ftell_last == ftell(X11_ipc) && x == xy_last[0] && y == xy_last[1] )
+        return;
+
     PRINT2("V%d %d\n", x, y);
+
+    ftell_last = ftell(X11_ipc);
+    xy_last[0] = x;
+    xy_last[1] = y;
 }
 
 TERM_PUBLIC void
-- 
1.7.10.4

